package com.sample.base.rxjava;

import android.content.Context;

import androidx.annotation.NonNull;

import com.loyal.client.RxConfig;
import com.loyal.rx3.BaseRxSubscriber;
import com.loyal.rx3.RetroManager;

import io.reactivex.rxjava3.core.Observable;
import okhttp3.ResponseBody;

public class RxProgressSubscriber<T> extends BaseRxSubscriber<T> implements ServiceImpl {
    private ServiceImpl service;

    public RxProgressSubscriber(Context context) {
        super(context);
    }

    public RxProgressSubscriber(Context context, @NonNull RxConfig config) {
        super(context, config);
    }

    @Override
    public void createServer(RetroManager manager) {
        service = manager.createServer(ServiceImpl.class);
    }

    @Override
    public Observable<String> doLogin(String json) {
        return service.doLogin(json);
    }

    @Override
    public Observable<ResponseBody> downloadImage(String url) {
        return service.downloadImage(url);
    }
}
